<%@page contentType="text/html;charset=utf-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>   
<script type="text/javascript">

function cm_saveproject(type)
{
    var id = document.getElementById("id").value;
    var channelid = document.getElementById("channelid").value;
    var name = document.getElementById("name").value;
    var date = document.getElementById("date1").value;
    var desc = document.getElementById("desc").value;

    if (/*rl_id == null || rl_id == "" 
        || */name == null || name == ""/*
        || rl_value == null || rl_value == ""*/)
    {
        alert("信息不完整！");
        return false;
    }

    if (!confirm("确定继续？"))
    {
        return false;
    }
    var url = "mg/project/save.do";
    var content = "type=" + type
                + "&project.id=" + id
                + "&project.channelId=" + channelid
                + "&project.name=" + name
                + "&shipDate=" + date 
                + "&project.shipDesc=" + desc;
    /*alert(content);*/
    var objectid = "cm_project";
    sendXMLHttpRequest(url, content, objectid); 
}
</script>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="5"></td>
    <td>   
  <form id="myform">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="3">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/table_top_left.jpg" width="20" height="15" /></td>
            <td><img src="images/table_top_bg.jpg" width="770" height="15"/></td>
            <td align="right">
              <img src="images/table_top_right.jpg" width="20" height="15" /></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td height="25" colspan="3" class="table_blue">
        <strong><img src="images/dot.jpg" width="13" height="9">项目信息</strong></td>
    </tr> 
    <tr>
      <td class="table_w1" align="center" width="20%">&nbsp;<font color="red">(*)</font>名称：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="id" type="hidden" value="<s:property value="project.id" />" >
        <input id="name" type="text" size="60" 
          value="<s:property value="project.name" />" /></td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="10%">出货日期：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input type="text" id="date1" dojoType="dijit.form.DateTextBox" name="date1" style="width:135px;"
           value="<s:property value="%{formatDate(project.shipDate,'yyyy-MM-dd')}" />" constraints="{datePattern:'yyyy-MM-dd'}" />   
      </td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="20%">&nbsp;出货说明：</td>
      <td class="table_w2" colspan="2">&nbsp;&nbsp;<textarea id="desc" name="desc" rows="3" cols="55"><s:property value="project.shipDesc" /></textarea></td>
    </tr>
    <tr>
      <td colspan="3" class="table_w1" align="center">
        <s:if test="type.equals('insert')" >
        <button id="btn2" dojoType="dijit.form.Button"
            onclick="cm_saveproject('insert');">添加</button>
        </s:if>
        <s:else>
        <button id="btn2" dojoType="dijit.form.Button"
            onclick="cm_saveproject('update');">修改</button>
        &nbsp;&nbsp;        
        <button id="btn3" dojoType="dijit.form.Button"
            onclick="cm_saveproject('delete');">删除</button>
        </s:else>
      </td>      
    </tr>
    <tr> 
      <td colspan="3" background="images/table_bom_bg.jpg">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/table_bom_left.jpg" width="20" height="15"></td>
          <td></td>
          <td align="right">
            <img src="images/table_bom_right.jpg" width="20" height="15"></td>
        </tr>
        </table>
      </td>
    </tr>
  </table>  
  </form>
  </td>
  <td width="5"></td>
  </tr>
  </table>